<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//----------------------- 首页路由 ----------------------------------
//前台首页 展示专业信息 默认显示php专业信息
Route::get('/{profession?}', 'Home\IndexController@index');

//前台群组路由
Route::group(['prefix'=>'home','namespace'=>'Home'],function(){

    //前台登录页
    Route::match(['post','get'],'login/index','LoginController@index')->name('front_login');

    //课程详情页
    Route::get('course/detail/{course}','CourseController@detail');

    //添加购物车
    Route::get('course/cart_add/{course}','CourseController@cart_add');

    //需要登录后才可以看的页面 使用auth中间件
    Route::group(['middleware'=>'auth:front'],function(){
        //前台 个人中心 展示直播课程展示
        Route::match(['post','get'],'person/course','PersonController@course');

        //退出登录
        Route::get('login/logout','LoginController@logout');

        //去购物车页面
        Route::get('shop/cart_account','ShopController@cart_account');

        //删除购物里的商品
        Route::get('shop/del/{course}','ShopController@del');

        //购物车结算
        Route::get('shop/cart_pay','ShopController@cart_pay');

        //支付完成 回传get请求(开发环境)
        Route::get('shop/return_url','ShopController@return_url');

        //支付完成 回传post请求（生产环境）
        Route::post('shop/notify_url','ShopController@notify_url');

        //试卷展示
        Route::get('exam/index','ExamController@index');

        //试题展示
        Route::match(['post','get'],'exam/run/{paper}','ExamController@run');

        //试卷结果查看
        Route::get('exam/result/{paper}','ExamController@result');
    });



});

//---------------------首页路由 END --------------------------

//------------------后台路由--------------------------------------------
//路由群组 路由前缀 命名空间
Route::group(['prefix'=>'admin','namespace'=>'Admin'],function(){
    //后台登录页
    Route::match(['get','post'],'manager/login','ManagerController@login')->name('login');

//使用auth中间件  检查用户是否登录 auth中间件并有back的guard设置
Route::group(['middleware'=>'auth:back'],function(){
    //后台首页
    Route::get('index/index','IndexController@index');
    //后台首页中的欢迎页
    Route::get('index/welcome','IndexController@welcome');
    //后台退出登录
    Route::get('index/logout','IndexController@logout');


    //路由群组 防止翻墙 中间件
Route::group(['middleware'=>'wall'],function(){
    //课程相关---试卷列表
        Route::match(['get','post'],'paper/index','PaperController@index');

    //课程相关---考题列表
        Route::get('question/index/{paper}','QuestionController@index');

    //课程相关---考题添加
        Route::match(['post','get'],'question/add/{paper}','QuestionController@add');


    //课程相关---课时显示页
        Route::match(['get','post'],'lesson/index','LessonController@index');

    //课程相关---添加课时
        Route::match(['get','post'],'lesson/add','LessonController@add');

    //课程相关---上传视频
        Route::post('upload/up_video','UploadController@up_video');

    //课程相关---上传图片
        Route::post('upload/up_pic','UploadController@up_pic');

    //课程相关---播放视频
        Route::get('lesson/video_play/{lesson}','LessonController@video_play');

    //课程相关---修改课时信息
        Route::match(['get','post'],'lesson/edit/{lesson}','LessonController@edit');

    //课程相关---删除课时信息
        Route::post('lesson/delete/{lesson}','LessonController@delete');

    //课程相关---恢复删除的课时信息展示
        Route::match(['post','get'],'lesson/restore','LessonController@restore');

    //课程相关---恢复单条数据
        Route::post('lesson/restoreOne/{lesson}','LessonController@restoreOne');

    //课程相关---直播流列表显示
        Route::get('stream/index','StreamController@index');

    //课程相关---直播流添加
        Route::match(['post','get'],'stream/add','StreamController@add');

    //课程相关---直播流删除
        Route::post('stream/del/{stream}','StreamController@del');

    //课程相关---直播流名编辑
        Route::match(['post','get'],'stream/edit/{stream}','StreamController@edit');

    //课程相关---课程直播列表
        Route::match(['post','get'],'livecourse/index','LivecourseController@index');

    //课程相关---添加直播课程
        Route::match(['post','get'],'livecourse/add','LivecourseController@add');

    //课程相关---上传 直播课程的文件
        Route::post('upload/livecourse','UploadController@livecourse');

    //课程相关---编辑直播课程
        Route::match(['post','get'],'livecourse/edit/{livecourse}','LivecourseController@edit');

    //课程相关---获取直播流地址
        Route::get('livecourse/getpush/{livecourse}/{stream}','LivecourseController@getpush');

    //权限管理---管理员列表
        Route::get('manager/index','ManagerController@index');
    //权限管理---角色列表
        Route::match(['post','get'],'role/index','RoleController@index');

    //权限管理---角色编辑
        Route::match(['post','get'],'role/edit/{role}','RoleController@edit');

    //权限管理---权限列表
        Route::get('permission/index','PermissionController@index');

    //权限管理---权限列表---修改
        Route::match(['post','get'],'permission/edit/{permission}','PermissionController@edit');

    //权限管理---权限列表---添加
        Route::match(['post','get'],'permission/add','PermissionController@add');
        });
    });
});






